#!/usr/bin/env bash

protoDir="../proto"
outDir="../proto"

# 编译google.api
protoc -I ${protoDir}/ ${protoDir}/google/api/*.proto \
	--go_out ${outDir} \
	--go_opt paths=source_relative

# 编译自定义的proto   
protoc -I ${protoDir}/ ${protoDir}/*.proto \
	--go_out ${outDir}/pb \
	--go_opt paths=source_relative \
	--go-grpc_out ${outDir}/pb \
	--go-grpc_opt paths=source_relative \
	--go-grpc_opt require_unimplemented_servers=false \
	--grpc-gateway_out ${outDir}/pb \
	--grpc-gateway_opt logtostderr=true \
	--grpc-gateway_opt paths=source_relative \
	--grpc-gateway_opt generate_unbound_methods=true \
	--openapiv2_out ${outDir}/pb \
	--openapiv2_opt logtostderr=true 